package com.alibaba.api.gateway.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.alipay.api.user.model.UserDto;
import com.alibaba.alipay.api.user.service.HelloService;

@RestController
@RequestMapping(path = "/users")
public class UserController {
	
	@Autowired
	private HelloService helloService;
	
	@RequestMapping(path = "/{id}", method = RequestMethod.GET)
	public UserDto hello() {
		long t1 = System.currentTimeMillis();
        UserDto userDto = new UserDto();
        userDto.setUsername("xxx");
        userDto.setPassword("password");
        userDto.setAge(100);
        String result = helloService.hello(userDto);
        long t2 = System.currentTimeMillis();
        System.out.println("完成调用，系统耗时：" + (t2 - t1) + "ms，调用结果：" + result);
        userDto.setUsername(result);
        return userDto;
	}

}
